package com.xiaoshuidi.cloud.module.bpm.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum SexEnum {
    MALE(1,"男"),
    FEMALE(2,"女");
    private Integer code;
    private String name;

    public static String getNameByCode(int code){
        SexEnum sexEnum = Arrays.stream(SexEnum.values()).filter(p -> p.getCode() == code).findFirst().orElse(null);
        if(sexEnum == null){
            return null;
        }
        return sexEnum.getName();
    }
}
